/**
  ******************************************************************************
  * @file    rs485.h
  * @brief   This file contains all the function prototypes for
  *          the rs485.c file
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2023 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef _RS485_H_
#define _RS485_H_

#ifdef __cplusplus
extern "C" {
#endif

/* Includes */
#include "main.h"
#include "usart.h"
#include "gpio.h"

/* Configuration defines */
#ifdef PROJECT_OUTPUT
#define RS485_DE_RE_PIN             $@{rs485_dere_pin}@$
#define RS485_UART_NO               $@{uart_no}@$
#else
#define RS485_DE_RE_PIN             GPIOB13
#define RS485_UART_NO               0
#endif
/* Variables */
extern char RS485DataBuff[1024];

/* Prototypes */
void RS485_Init(void);
void RS485_SendData(uint32_t pin,UART_HandleTypeDef *huart,u8 *buf,u8 len);
HAL_StatusTypeDef RS485_RecvData(uint32_t pin,UART_HandleTypeDef *huart,u8 *buf,u8 len);

void DemoRS485Init(void);
void DemoRS485(void);

#ifdef __cplusplus
}
#endif

#endif /* _RS485_H_ */

